import Vue from 'vue'
import Vuex from 'vuex'
import router, {resetRouter} from "@/router";

Vue.use(Vuex)

const store = new Vuex.Store({
    state: {
        currentPathName: '',
    },
    mutations: {
        setPath(state){
            state.currentPathName = localStorage.getItem('currentPathName')
        },
        resetUser() {
            localStorage.removeItem('user')
            localStorage.removeItem('menus')
            router.push("/")

            // 重置路由
            resetRouter()

        }

    }

})
export default store